<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改sysStudent')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-student-edit" th:object="${sysStudent}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">姓名：</label>
                <div class="col-sm-8">
                    <input name="userName" th:field="*{userName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">学号：</label>
                <div class="col-sm-8">
                    <input name="studentId" th:field="*{studentId}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">性别：</label>
                <div class="col-sm-8">
                    <select name="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{sex}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">身份证号：</label>
                <div class="col-sm-8">
                    <input name="card" th:field="*{card}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">联系方式：</label>
                <div class="col-sm-8">
                    <input name="phone" th:field="*{phone}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">出生年月：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="brithday" th:value="${#dates.format(sysStudent.brithday, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">籍贯：</label>
                <div class="col-sm-8">
                    <input name="hometown" th:field="*{hometown}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">学院：</label>
                <div class="col-sm-8">
                    <select id="colleges" name="collegeId" class="form-control" >
                        <option th:each="college:${colleges}" th:value="${college.id}" th:text="${college.collegeName}" th:selected="${college.flag}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                  <label class="col-sm-3 control-label">班级：</label>
                <div class="col-sm-8">
                    <select id="classz" name="classesId" class="form-control" >
                        <option th:each="classes:${classz}" th:value="${classes.id}" th:text="${classes.classesName}" th:selected="${classes.flag}"></option>
                    </select>
               </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">年级：</label>
                <div class="col-sm-8">
                    <input name="grade" th:field="*{grade}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">专业：</label>
                <div class="col-sm-8">
                    <input name="professional" th:field="*{professional}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">家庭住址：</label>
                <div class="col-sm-8">
                    <input name="address" th:field="*{address}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">政治面貌：</label>
                <div class="col-sm-8">
                    <input name="politicalStatus" th:field="*{politicalStatus}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">兴趣爱好：</label>
                <div class="col-sm-8">
                    <input name="hobby" th:field="*{hobby}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "teacher/student";
        $("#form-student-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-student-edit').serialize());
            }
        }

        $("input[name='brithday']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(function() {
            $('#colleges').select2({
                placeholder: "请选择学院",
                allowClear: true
            });
            $('#classz').select2({
                placeholder: "请选择班级",
                allowClear: true
            });
        })
    </script>
</body>
</html>